import apis from './'
import request from '@/utils/request'

export function getContractList (parameter) {
  return request({
    url: apis.ContractList,
    method: 'get',
    params: parameter
  })
}

export function getEditStatus (id) {
  return request({
    url: `${apis.EditContractStatus}?contract_id=${id}`,
    method: 'get'
  })
}

export function postEditStatus (data) {
  return request({
    url: `${apis.EditContractStatus}?contract_id=${data.contract_id}`,
    method: 'post',
    data: data
  })
}

export function getContractBase (id) {
  return request({
    url: `${apis.ContractDetail}?contract_id=${id}`,
    method: 'get'
  })
}

export function getBusinessList (parameter) {
  return request({
    url: apis.BusinessList,
    method: 'get',
    params: parameter
  })
}

export function getEditPaid (id) {
  return request({
    url: `${apis.EditPaid}?cb_id=${id}`,
    method: 'get'
  })
}

export function getDelPaid (id) {
  return request({
    url: `${apis.DelPaid}?cf_id=${id}`,
    method: 'get'
  })
}

export function postEditPaid (data) {
  return request({
    url: `${apis.EditPaid}?cb_id=${data.cb_id}`,
    method: 'post',
    data: data
  })
}

export function getPayment (parameter) {
  return request({
    url: apis.PaymentList,
    method: 'get',
    params: parameter
  })
}

export function getEditRemark (id) {
  return request({
    url: `${apis.EditRemarks}?payment_id=${id}`,
    method: 'get'
  })
}

export function postEditRemark (data) {
  return request({
    url: `${apis.EditRemarks}?payment_id=${data.payment_id}`,
    method: 'post',
    data: data
  })
}

export function postEditTime (data) {
  return request({
    url: `${apis.EditCheckTime}?payment_id=${data.payment_id}`,
    method: 'post',
    data: data
  })
}

export function getAddressList (parameter) {
  return request({
    url: apis.AddressList,
    method: 'get',
    params: parameter
  })
}

export function getHistoryList (parameter) {
  return request({
    url: apis.HistoryList,
    method: 'get',
    params: parameter
  })
}

export function getIsOpen (parameter) {
  return request({
    url: `${apis.IsOpenBusiness}?contract_id=${parameter.contract_id}&cb_id=${parameter.cb_id}`,
    method: 'get'
  })
}

export function postIsOpen (data) {
  return request({
    url: `${apis.IsOpenBusiness}?contract_id=${data.contract_id}&cb_id=${data.cb_id}`,
    method: 'post',
    data: data
  })
}

export function allOpen (id) {
  return request({
    url: `${apis.AllOpen}?contract_id=${id}`,
    method: 'get'
  })
}

export function batchOpen (parameter) {
  return request({
    url: apis.BatchOpen,
    method: 'get',
    params: parameter
  })
}

export function abandonContract (id) {
  return request({
    url: `${apis.AbandonContract}?contract_id=${id}`,
    method: 'get'
  })
}

export function allStop (id) {
  return request({
    url: `${apis.AllStop}?contract_id=${id}`,
    method: 'get'
  })
}

export function batchStop (parameter) {
  return request({
    url: apis.BatchStop,
    method: 'get',
    params: parameter
  })
}

export function batchOfficial (data, parameter) {
  return request({
    url: apis.EditOfficial,
    method: 'post',
    data: data,
    params: parameter
  })
}

export function batchPrice (data, parameter) {
  return request({
    url: apis.EditPrice,
    method: 'post',
    data: data,
    params: parameter
  })
}

export function getBusinessDetail (id) {
  return request({
    url: `${apis.BusinessDetail}?cb_id=${id}`,
    method: 'get'
  })
}

export function getAbandonList (parameter) {
  return request({
    url: apis.AbandonContractList,
    method: 'get',
    params: parameter
  })
}

export function recoverContract (id) {
  return request({
    url: `${apis.RecoverContract}?contract_id=${id}`,
    method: 'get'
  })
}

export function sendSms () {
  return request({
    url: apis.ContractSms,
    method: 'get'
  })
}

export function checkSms (data) {
  return request({
    url: apis.ContractSms,
    method: 'post',
    data: data
  })
}

export function batchCost (parameter, data) {
  return request({
    url: apis.BatchCost,
    method: 'post',
    params: parameter,
    data: data
  })
}
